package com.ctl.szmd.szmd.feature_wm.data

import androidx.paging.PagingConfig
import com.ctl.szmd.szmd.feature_wm.data.api.WmService
import com.ctl.szmd.szmd.feature_wm.data.repository.WmRepository
import com.ctl.szmd.szmd.feature_wm.data.repository.WmRepositoryImpl

/**
 * created by : chentl
 * Date: 2020/07/30
 */
object WmFactory {

    fun makeWmRepository(api: WmService): WmRepository =
        WmRepositoryImpl(api, pagingConfig)

    val pagingConfig = PagingConfig(
        // 每页显示的数据的大小
        pageSize = 30,

        // 开启占位符
        enablePlaceholders = true,

        // 预刷新的距离，距离最后一个 item 多远时加载数据
        // 默认为 pageSize
        prefetchDistance = 1,

        /**
         * 初始化加载数量，默认为 pageSize * 3
         *
         * internal const val DEFAULT_INITIAL_PAGE_MULTIPLIER = 3
         * val initialLoadSize: Int = pageSize * DEFAULT_INITIAL_PAGE_MULTIPLIER
         */

        /**
         * 初始化加载数量，默认为 pageSize * 3
         *
         * internal const val DEFAULT_INITIAL_PAGE_MULTIPLIER = 3
         * val initialLoadSize: Int = pageSize * DEFAULT_INITIAL_PAGE_MULTIPLIER
         */
        initialLoadSize = 30
    )
}